home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / SASETUP.MSI / F77667_nicip_prop.asp < prev    next >
Encoding:
Text File  |  2003-02-21  |  56.4 KB  |  3,161 lines

  1. <%@Language=VbScript%>
  2.  
  3. <% Option Explicit    %>
  4.  
  5. <%  
  6.  
  7.     '-------------------------------------------------------------------------
  8.  
  9.     ' nicip_prop.asp : Page gets/sets the IP adresses along with
  10.  
  11.     '                   GateWay Addresses 
  12.  
  13.     '
  14.  
  15.     ' Copyright (c) Microsoft Corporation.  All rights reserved. 
  16.  
  17.     '
  18.  
  19.     ' Date            Description
  20.  
  21.     ' 06-Mar-2001    Created date
  22.  
  23.     ' 10-Mar-2001    Modified date
  24.  
  25.     '-------------------------------------------------------------------------
  26.  
  27. %>    
  28.  
  29.     <!--  #include virtual="/admin/inc_framework.asp"--->
  30.  
  31.     <!--  #include file="inc_network.asp" -->
  32.  
  33.     <!--  #include file="loc_nicspecific.asp" -->        
  34.  
  35. <% 
  36.  
  37.     '-------------------------------------------------------
  38.  
  39.     ' Form Variables
  40.  
  41.     '-------------------------------------------------------
  42.  
  43.     Dim F_strIPAddress        ' to hold IP address
  44.  
  45.     Dim F_strSubnetMask        ' to hold subnet mask
  46.  
  47.     Dim F_nConnectionMetric    ' to hold connection metric
  48.  
  49.     Dim F_strGatewayAddress    ' to hold gateway address
  50.  
  51.     Dim F_strListIP            ' to hold array of IP
  52.  
  53.     Dim F_strListGateway    ' to hold array of Gateway    
  54.  
  55.     Dim F_strRadIP            ' to hold the radio button selected
  56.  
  57.     
  58.  
  59.     '-------------------------------------------------------
  60.  
  61.     ' Global Variables
  62.  
  63.     '-------------------------------------------------------
  64.  
  65.     Dim g_arrIPList                ' List of IP Addresses
  66.  
  67.     Dim g_arrGATEWAYList        ' List of Gateway Addresses
  68.  
  69.     Dim page                    ' to hold page object
  70.  
  71.     Dim blnDHCPEnabled            ' to hold whether DHCP is enabled or not
  72.  
  73.     Dim g_strDeviceID            ' to hold device ID
  74.     
  75.     Dim g_initialIPAddress
  76.     
  77.  
  78.     Dim SOURCE_FILE
  79.  
  80.     SOURCE_FILE = SA_GetScriptFileName()
  81.  
  82.  
  83.  
  84.     Dim g_iTabGeneral            ' to hold value of general page
  85.  
  86.     Dim g_iTabAdvanced            ' to hold value of Advanced page    
  87.  
  88.     
  89.  
  90.     Dim g_strTabValue            ' to hold value of general tab
  91.  
  92.     Dim g_strAdvTabValue        ' to hold value of Advanced tab
  93.  
  94.     
  95.  
  96.     Const G_CONST_REGISTRY_PATH ="SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces"
  97.  
  98.     
  99.  
  100.     '-------------------------------------------------------
  101.  
  102.     ' Entry point
  103.  
  104.     '-------------------------------------------------------
  105.  
  106.  
  107.  
  108.     ' Create a Property Page
  109.  
  110.     Call SA_CreatePage( L_TASKTITLE_TEXT, "", PT_TABBED, page )
  111.  
  112.  
  113.  
  114.     Call SA_AddTabPage(page, L_GENERAL_TEXT, g_iTabGeneral)
  115.  
  116.     Call SA_AddTabPage(page, L_ADVANCED_TEXT, g_iTabAdvanced)
  117.  
  118.     
  119.  
  120.     ' Serve the page
  121.  
  122.     Call SA_ShowPage( page )
  123.  
  124.  
  125.  
  126.     '-------------------------------------------------------
  127.  
  128.     ' Web Framework Event Handlers
  129.  
  130.     '-------------------------------------------------------
  131.  
  132.     '-------------------------------------------------------------------------
  133.  
  134.     'Function:                OnInitPage()
  135.  
  136.     'Description:            Called to signal first time processing for this page. 
  137.  
  138.     '                        Use this method to do first time initialization tasks. 
  139.  
  140.     'Input Variables:        PageIn,EventArg
  141.  
  142.     'Output Variables:        PageIn,EventArg
  143.  
  144.     'Returns:                TRUE to indicate initialization was successful. FALSE to indicate
  145.  
  146.     '                        errors. Returning FALSE will cause the page to be abandoned.
  147.  
  148.     'Global Variables:        None
  149.  
  150.     '-------------------------------------------------------------------------
  151.  
  152.     Public Function OnInitPage(ByRef PageIn, ByRef EventArg)
  153.  
  154.         Dim itemCount    'holds item count
  155.  
  156.         Dim x            'holds increment count for the loop
  157.  
  158.         Dim itemKey        'holds the item selected from the OTS page
  159.  
  160.         Call SA_TraceOut(SOURCE_FILE, "OnInitPage")
  161.  
  162.         
  163.  
  164.         itemCount = OTS_GetTableSelectionCount("")
  165.  
  166.     
  167.  
  168.         For x = 1 to itemCount
  169.  
  170.             If ( OTS_GetTableSelection("", x, itemKey) ) Then
  171.  
  172.                 g_strDeviceID = itemKey ' to get the device ID
  173.  
  174.                 Exit for
  175.  
  176.             End If
  177.  
  178.         Next        
  179.  
  180.  
  181.  
  182.         OnInitPage = TRUE
  183.  
  184.  
  185.  
  186.     End Function
  187.  
  188.  
  189.  
  190.     '-------------------------------------------------------------------------
  191.  
  192.     'Function:                OnServeTabbedPropertyPage
  193.  
  194.     'Description:            Called when the page needs to be served.Use this 
  195.  
  196.     '                        method to serve content
  197.  
  198.     'Input Variables:        PageIn,EventArg, iTab,bIsVisible
  199.  
  200.     'Output Variables:        PageIn,EventArg 
  201.  
  202.     'Returns:                TRUE to indicate not problems occured. FALSE to indicate errors.
  203.  
  204.     '                        Returning FALSE will cause the page to be abandoned.
  205.  
  206.     'Global Variables:        SOURCE_FILE, g_*
  207.  
  208.     '-------------------------------------------------------------------------
  209.  
  210.     Public Function OnServeTabbedPropertyPage(ByRef PageIn, _
  211.  
  212.                                                     ByVal iTab, _
  213.  
  214.                                                     ByVal bIsVisible, ByRef EventArg)
  215.  
  216.  
  217.  
  218.         Call SA_TraceOut(SOURCE_FILE, "OnServeTabbedPropertyPage")        
  219.  
  220.  
  221.  
  222.         Select Case iTab
  223.  
  224.         
  225.  
  226.             Case g_iTabGeneral
  227.  
  228.                 Call ServeTabGeneral(PageIn, bIsVisible)
  229.  
  230.                 
  231.  
  232.             Case g_iTabAdvanced
  233.  
  234.                 Call ServeTabAdvanced(PageIn, bIsVisible)
  235.  
  236.                 
  237.  
  238.             Case Else
  239.  
  240.                 Call SA_TraceErrorOut(SOURCE_FILE, "OnServeTabbedPropertyPage unrecognized tab id: " + CStr(iTab))
  241.  
  242.         End Select
  243.  
  244.             
  245.  
  246.         OnServeTabbedPropertyPage = TRUE
  247.  
  248.  
  249.  
  250.     End Function
  251.  
  252.  
  253.  
  254.     '-------------------------------------------------------------------------
  255.  
  256.     'Function:                OnPostBackPage()
  257.  
  258.     'Description:            Called to signal a post-back. A post-back occurs as the user
  259.  
  260.     '                        navigates through pages. This event should be used to save the
  261.  
  262.     '                        state of the current page. 
  263.  
  264.     'Input Variables:        PageIn,EventArg
  265.  
  266.     'Output Variables:        PageIn,EventArg
  267.  
  268.     'Returns:                True
  269.  
  270.     'Global Variables:        F_*,G_*,g_*
  271.  
  272.     '-------------------------------------------------------------------------
  273.  
  274.     Public Function OnPostBackPage(ByRef PageIn, ByRef EventArg)
  275.  
  276.     
  277.  
  278.         Call SA_TraceOut(SOURCE_FILE, "OnPostBackPage")
  279.  
  280.                 
  281.  
  282.         g_strTabValue    = Request.Form("hdnGeneralTabValue")
  283.  
  284.         g_strAdvTabValue = Request.Form("hdnAdvancedTabValue")
  285.  
  286.         g_strDeviceID    = Request.Form("hdnDeviceID")
  287.         
  288.         g_initialIPAddress  = Request.Form("hdnInitialIPValue") 
  289.  
  290.         F_strRadIP       = Request.Form("hdnRadIP")
  291.  
  292.         F_strListIP      = Request.Form("hdnlstIP")
  293.  
  294.         F_strListGateway = Request.Form("hdnlstGATEWAY")        
  295.  
  296.         F_strIPAddress   = Request.Form("txtIP")
  297.  
  298.         F_strSubnetMask  = Request.Form("txtMask")
  299.  
  300.         F_strGatewayAddress = Request.Form("txtGateway")
  301.  
  302.         F_nConnectionMetric = Request.Form("txtConnectionMetric")
  303.  
  304.         
  305.  
  306.         OnPostBackPage = TRUE
  307.  
  308.     
  309.  
  310.     End Function
  311.  
  312.  
  313.  
  314.     '-------------------------------------------------------------------------
  315.  
  316.     'Function:                OnSubmitPage()
  317.  
  318.     'Description:            Called when the page has been submitted for processing.
  319.  
  320.     '                        Use this method to process the submit request.
  321.  
  322.     'Input Variables:        PageIn,EventArg
  323.  
  324.     'Output Variables:        PageIn,EventArg
  325.  
  326.     'Returns:                TRUE if the submit was successful, FALSE to indicate error(s).
  327.  
  328.     '                        Returning FALSE will cause the page to be served again using
  329.  
  330.     '                        a call to OnServeTabbedPropertyPage.
  331.  
  332.     'Global Variables:        F_*, g_*, blnDHCPEnabled, 
  333.  
  334.     '-------------------------------------------------------------------------
  335.  
  336.     Public Function OnSubmitPage(ByRef PageIn, ByRef EventArg)
  337.  
  338.         
  339.  
  340.         Call SA_TraceOut(SOURCE_FILE, "OnSubmitPage")
  341.  
  342.         'checking whether DHCP is enabled
  343.  
  344.         If  Ucase(Request.Form("radIP"))="IPDEFAULT" Then
  345.  
  346.             blnDHCPEnabled = TRUE
  347.  
  348.         Else
  349.  
  350.             blnDHCPEnabled = FALSE
  351.  
  352.         End If
  353.  
  354.  
  355.  
  356.         'Set Individual NIC properties
  357.  
  358.         OnSubmitPage = setNIC()
  359.  
  360.  
  361.  
  362.     End Function
  363.  
  364.     
  365.  
  366.     '-------------------------------------------------------------------------
  367.  
  368.     'Function:                OnClosePage()
  369.  
  370.     'Description:            Called when the page is about closed.Use this method
  371.  
  372.     '                        to perform clean-up processing
  373.  
  374.     'Input Variables:        PageIn,EventArg
  375.  
  376.     'Output Variables:        PageIn,EventArg
  377.  
  378.     'Returns:                TRUE to allow close, FALSE to prevent close. Returning FALSE
  379.  
  380.     '                        will result in a call to OnServeTabbedPropertyPage.
  381.  
  382.     'Global Variables:        None
  383.  
  384.     '-------------------------------------------------------------------------
  385.  
  386.     Public Function OnClosePage(ByRef PageIn, ByRef EventArg)
  387.  
  388.         Call SA_TraceOut(SOURCE_FILE, "OnClosePage")
  389.  
  390.         OnClosePage = TRUE
  391.  
  392.     End Function
  393.  
  394.  
  395.  
  396.     '-------------------------------------------------------------------------
  397.  
  398.     'Function:                ServeTabGeneral
  399.  
  400.     'Description:            Called when the general page needs to be served.    
  401.  
  402.     'Input Variables:        PageIn,EventArg
  403.  
  404.     'Output Variables:        PageIn,EventArg
  405.  
  406.     'Returns:                SA_NO_ERROR
  407.  
  408.     'Global Variables:        SOURCE_FILE, g_*,F_*
  409.  
  410.     '-------------------------------------------------------------------------
  411.  
  412.     Private Function ServeTabGeneral(ByRef PageIn, ByVal bIsVisible)
  413.  
  414.         
  415.  
  416.         Call SA_TraceOut(SOURCE_FILE, "ServeTabGeneral(PageIn,  bIsVisible="+ CStr(bIsVisible) + ")")
  417.  
  418.     
  419.  
  420.         If ( bIsVisible ) Then
  421.  
  422.             
  423.  
  424.             'call the java script function
  425.  
  426.             Call ServeCommonJavaScript()
  427.  
  428.             Call ServeGeneralTabJavaScript()
  429.  
  430.             
  431.  
  432.             'Serves UI for General tab
  433.  
  434.             Call ServeGeneralUI()
  435.  
  436.             
  437.  
  438.         Else
  439.  
  440.             Response.Write("<input type=hidden name=hdnDeviceID value='"+g_strDeviceID +"' >")
  441.  
  442.             Response.Write("<input type=hidden name=hdnGeneralTabValue value='"+g_strTabValue +"' >")
  443.  
  444.             Response.Write("<input type=hidden name=txtIP value='"+F_strIPAddress +"' >")
  445.  
  446.             Response.Write("<input type=hidden name=txtGateway value='"+F_strGatewayAddress +"' >")
  447.  
  448.             Response.Write("<input type=hidden name=txtMask value='"+F_strSubnetMask +"' >")
  449.  
  450.             Response.Write("<input type=hidden name=hdnRadIP value='"+F_strRadIP +"' >")
  451.  
  452.          End If
  453.  
  454.     
  455.  
  456.         ServeTabGeneral = SA_NO_ERROR
  457.  
  458.     
  459.  
  460.     End Function
  461.  
  462.  
  463.  
  464.     '-------------------------------------------------------------------------
  465.  
  466.     'Function:                ServeTabAdvanced
  467.  
  468.     'Description:            Called when the Advanced page needs to be served.    
  469.  
  470.     'Input Variables:        PageIn,EventArg
  471.  
  472.     'Output Variables:        PageIn,EventArg
  473.  
  474.     'Returns:                SA_NO_ERROR
  475.  
  476.     'Global Variables:        SOURCE_FILE, g_*,F_*
  477.  
  478.     '-------------------------------------------------------------------------
  479.  
  480.     Private Function ServeTabAdvanced(ByRef PageIn, ByVal bIsVisible)
  481.  
  482.         
  483.  
  484.         Call SA_TraceOut(SOURCE_FILE, "ServeTabAdvanced(PageIn,  bIsVisible="+ CStr(bIsVisible) + ")")    
  485.  
  486.     
  487.  
  488.         If ( bIsVisible ) Then        
  489.  
  490.             
  491.  
  492.             'Serve common javascript that is required for this page type.
  493.  
  494.             Call ServeCommonJavaScript()
  495.  
  496.             Call ServeAdvancedTabJavaScript()
  497.  
  498.             
  499.  
  500.             'Serve UI for Advanced tab            
  501.  
  502.             Call ServeAdvancedUI()    
  503.  
  504.             
  505.  
  506.         Else
  507.  
  508.             Response.Write("<input type=hidden name=hdnDeviceID value='"+g_strDeviceID +"' >")            
  509.  
  510.             Response.Write("<input type=hidden name=txtConnectionMetric value='"+F_nConnectionMetric +"' >")
  511.  
  512.             Response.Write("<input type=hidden name=hdnlstIP value='"+F_strListIP +"'>")
  513.  
  514.             Response.Write("<input type=hidden name=hdnlstGATEWAY value='"+F_strListGateway +"' >")
  515.  
  516.             Response.Write("<input type=hidden name=hdnAdvancedTabValue value='"+g_strAdvTabValue+"'>")            
  517.  
  518.          End If
  519.  
  520.         ServeTabAdvanced = SA_NO_ERROR
  521.  
  522.         
  523.  
  524.     End Function
  525.  
  526.  
  527.  
  528.     '-------------------------------------------------------------------------
  529.  
  530.     'Function:                ServeGeneralTabJavaScript
  531.  
  532.     'Description:            Serve common javascript that is required for general tab
  533.  
  534.     'Input Variables:        None
  535.  
  536.     'Output Variables:        None
  537.  
  538.     'Returns:                None
  539.  
  540.     'Global Variables:        None
  541.  
  542.     '-------------------------------------------------------------------------
  543.  
  544.     Function ServeGeneralTabJavaScript()
  545.  
  546.     %>
  547.  
  548.         <SCRIPT LANGUAGE="JavaScript">
  549.  
  550.                     
  551.  
  552.         //
  553.  
  554.         // Microsoft Server Appliance Web Framework Support Functions
  555.  
  556.         // Copyright (c) Microsoft Corporation.  All rights reserved. 
  557.  
  558.         //
  559.  
  560.         // Init Function
  561.  
  562.         // -----------
  563.  
  564.         // This function is called by the Web Framework to allow the page
  565.  
  566.         // to perform first time initialization. 
  567.  
  568.         //
  569.  
  570.         // This function must be included or a javascript runtime error will occur.
  571.  
  572.         //
  573.  
  574.         function Init()
  575.  
  576.         {
  577.  
  578.             var OptionSel = "<%=F_strRadIP %>";            
  579.  
  580.             
  581.  
  582.             if (OptionSel != "")
  583.  
  584.             {
  585.  
  586.                 document.frmTask.radIP[OptionSel].checked = true;                
  587.                 if (OptionSel == 0)
  588.                 {
  589.                     enableIPControls(true);
  590.                 }
  591.                 else if(OptionSel == 1)
  592.                 {
  593.                     enableIPControls(false);
  594.                 }
  595.  
  596.             }
  597.                     
  598.  
  599.             return true;
  600.  
  601.         }
  602.  
  603.             
  604.  
  605.         // ValidatePage Function
  606.  
  607.         // ------------------
  608.  
  609.         // This function is called by the Web Framework as part of the
  610.  
  611.         // submit processing. Used to validate user input. Returning
  612.  
  613.         // false will cause the submit to abort. 
  614.  
  615.         // Returns: True if the page is OK, false if error(s) exist. 
  616.  
  617.         function ValidatePage()
  618.  
  619.         {                    
  620.  
  621.             var retVal;
  622.             
  623.             if (document.frmTask.txtIP.disabled == false)
  624.  
  625.             {         
  626.  
  627.                                     
  628.  
  629.                 var IPVal = document.frmTask.txtIP;
  630.  
  631.                 if( IPVal.value != "")
  632.  
  633.                 {                
  634.  
  635.  
  636.  
  637.                     retVal = isValidIP(IPVal);
  638.                         
  639.  
  640.                     if(retVal!=0)
  641.  
  642.                     {                                        
  643.  
  644.                         //Calling to validate the IP and display the error message
  645.  
  646.                         SA_DisplayErr('<%=SA_EscapeQuotes(L_IP_ERRORMESSAGE)%>');
  647.  
  648.                         document.frmTask.onkeypress = ClearErr;                    
  649.  
  650.                         return false;
  651.  
  652.                     }
  653.  
  654.                 }    
  655.                 
  656.                 if (IPVal.value == "")
  657.                 {
  658.                 
  659.                         SA_DisplayErr('<%=SA_EscapeQuotes(L_IP_ERRORMESSAGE)%>');
  660.  
  661.                         document.frmTask.onkeypress = ClearErr;                    
  662.  
  663.                         return false;
  664.                 
  665.                 }
  666.                 
  667.  
  668.             }                        
  669.  
  670.             if (document.frmTask.txtMask.disabled == false)
  671.  
  672.             {
  673.  
  674.                 var IPMask = document.frmTask.txtMask;
  675.  
  676.                 var IPVal = document.frmTask.txtIP;
  677.  
  678.                 
  679.  
  680.                 if (IPMask.value == "" && IPVal.value != "") 
  681.  
  682.                 {                    
  683.  
  684.                     SA_DisplayErr('<%=SA_EscapeQuotes(L_INVALIDSUBNETADDRESSES_ERRORMESSAGE)%>');
  685.  
  686.                     return false;                
  687.  
  688.                 }
  689.  
  690.                 
  691.  
  692.                 if(IPMask.value != "")
  693.  
  694.                 {                
  695.  
  696.                     retVal = isValidSubnetMask(IPMask)
  697.  
  698.                     if(!retVal)
  699.  
  700.                     {
  701.  
  702.                         SA_DisplayErr('<%=SA_EscapeQuotes(L_INVALIDFORMATFORSUBNET_ERRORMESSAGE)%>');
  703.  
  704.                         return false;
  705.  
  706.                     }
  707.  
  708.                 }    
  709.  
  710.                 
  711.  
  712.                 retVal = isValidSubnetMask(IPMask)                
  713.  
  714.                 if(retVal == true && IPVal.value == "")
  715.  
  716.                 {
  717.  
  718.                     SA_DisplayErr('<%=SA_EscapeQuotes(L_IP_ERRORMESSAGE)%>');
  719.  
  720.                     document.frmTask.onkeypress = ClearErr;                    
  721.  
  722.                     return false;
  723.  
  724.                 }
  725.  
  726.             }
  727.  
  728.                             
  729.  
  730.             if (document.frmTask.txtGateway.disabled == false)
  731.  
  732.             {
  733.  
  734.                 var IPVal = document.frmTask.txtGateway;
  735.  
  736.                 if ( IPVal.value != "")
  737.  
  738.                 {
  739.  
  740.                     retVal = isValidIP(IPVal)
  741.  
  742.                     if(retVal!=0)
  743.  
  744.                     {            
  745.  
  746.                         //Calling to validate the IP and display the error message
  747.  
  748.                         SA_DisplayErr('<%=SA_EscapeQuotes(L_IP_ERRORMESSAGE)%>');
  749.  
  750.                         document.frmTask.onkeypress = ClearErr;                    
  751.  
  752.                         return false;
  753.  
  754.                     }
  755.  
  756.                 }
  757.                 else    // checking for the blank gateway case 
  758.                 {
  759.                     SA_DisplayErr('<%=SA_EscapeQuotes(L_GATEWAY_ERRORMESSAGE)%>');
  760.  
  761.                     document.frmTask.onkeypress = ClearErr;                    
  762.  
  763.                     return false;
  764.                 }    
  765.  
  766.             }
  767.  
  768.             
  769.  
  770.             document.frmTask.hdnGeneralTabValue.value = "true";
  771.  
  772.             
  773.  
  774.             if(document.frmTask.radIP[0].checked==true)
  775.  
  776.             {
  777.  
  778.                 document.frmTask.hdnRadIP.value = 0;
  779.  
  780.             }
  781.  
  782.             else if(document.frmTask.radIP[1].checked)            
  783.  
  784.             {    
  785.  
  786.                 document.frmTask.hdnRadIP.value = 1;
  787.  
  788.             }
  789.  
  790.             
  791.  
  792.             return true;
  793.  
  794.         }
  795.  
  796.  
  797.  
  798.         // SetData Function
  799.  
  800.         // --------------
  801.  
  802.         // This function is called by the Web Framework and is called
  803.  
  804.         // only if ValidatePage returned a success (true) code. 
  805.  
  806.         function SetData()
  807.  
  808.         {
  809.  
  810.             return true;
  811.  
  812.         }
  813.  
  814.         </SCRIPT>
  815.  
  816.     <%
  817.  
  818.     End Function
  819.  
  820.     
  821.  
  822.     '-------------------------------------------------------------------------
  823.  
  824.     'Function:                ServeAdvancedTabJavaScript
  825.  
  826.     'Description:            Serve common javascript that is required for Advanced tab
  827.  
  828.     'Input Variables:        None
  829.  
  830.     'Output Variables:        None
  831.  
  832.     'Returns:                None
  833.  
  834.     'Global Variables:        None
  835.  
  836.     '-------------------------------------------------------------------------
  837.  
  838.     Function ServeAdvancedTabJavaScript()
  839.  
  840.     %>
  841.  
  842.         <SCRIPT LANGUAGE="JavaScript">
  843.  
  844.                     
  845.  
  846.         //
  847.  
  848.         // Microsoft Server Appliance Web Framework Support Functions
  849.  
  850.         // Copyright (c) Microsoft Corporation.  All rights reserved. 
  851.  
  852.         //
  853.  
  854.         // Init Function
  855.  
  856.         // -----------
  857.  
  858.         // This function is called by the Web Framework to allow the page
  859.  
  860.         // to perform first time initialization. 
  861.  
  862.         function Init()
  863.  
  864.         {
  865.  
  866.             var OptionSel = "<%=F_strRadIP %>";
  867.  
  868.             if (OptionSel == 0)
  869.  
  870.             {
  871.  
  872.                 
  873.  
  874.                 // disable IP controls
  875.  
  876.                 document.frmTask.lstIP.disabled = true;
  877.  
  878.                 document.frmTask.btnAddIP.disabled = true;
  879.  
  880.                 document.frmTask.btnRemoveIP.disabled = true;
  881.  
  882.                 document.frmTask.txtAdvIP.disabled = true;
  883.  
  884.                 document.frmTask.txtAdvMask.disabled = true;
  885.  
  886.                 
  887.  
  888.                 // disable Gateway controls
  889.  
  890.                 document.frmTask.lstGATEWAY.disabled = true;
  891.  
  892.                 document.frmTask.txtAdvGATEWAY.disabled = true;
  893.  
  894.                 document.frmTask.btnAddGATEWAY.disabled = true;
  895.  
  896.                 document.frmTask.txtGATEWAYMetric.disabled = true;
  897.  
  898.                 document.frmTask.btnRemoveGATEWAY.disabled = true;                
  899.  
  900.             }
  901.  
  902.             else
  903.  
  904.             {
  905.  
  906.         
  907.  
  908.                 LimitListLength(document.frmTask.lstIP,40,document.frmTask.txtAdvIP,document.frmTask.txtAdvMask,document.frmTask.btnAddIP);
  909.  
  910.                 LimitListLength(document.frmTask.lstGATEWAY,20,document.frmTask.txtAdvGATEWAY,document.frmTask.txtGATEWAYMetric,document.frmTask.btnAddGATEWAY);
  911.  
  912.             
  913.  
  914.                 // default value of Gateway metric 
  915.  
  916.                 if(document.frmTask.lstGATEWAY.length >=20)
  917.  
  918.                     document.frmTask.txtGATEWAYMetric.value = "";
  919.  
  920.                 else
  921.  
  922.                     document.frmTask.txtGATEWAYMetric.value = 1;
  923.  
  924.                     
  925.  
  926.                 document.frmTask.btnAddIP.disabled = true;
  927.  
  928.                 document.frmTask.btnAddGATEWAY.disabled = true;
  929.  
  930.             }
  931.             
  932.             
  933.             if(document.frmTask.lstIP.length == 0)
  934.                 document.frmTask.btnRemoveIP.disabled = true;
  935.                 
  936.             if(document.frmTask.lstGATEWAY.length == 0)
  937.                 document.frmTask.btnRemoveGATEWAY.disabled = true;    
  938.                 
  939.                 
  940.  
  941.             return true;
  942.  
  943.         }
  944.  
  945.             
  946.  
  947.         // ValidatePage Function
  948.  
  949.         // ------------------
  950.  
  951.         // This function is called by the Web Framework as part of the
  952.  
  953.         // submit processing. Used to validate user input. Returning
  954.  
  955.         // false will cause the submit to abort. 
  956.  
  957.         // Returns: True if the page is OK, false if error(s) exist. 
  958.  
  959.         function ValidatePage()
  960.  
  961.         {
  962.  
  963.             var i=0;
  964.  
  965.             var arrIP = "";
  966.  
  967.             var arrGatewayIP = "";
  968.  
  969.             if(document.frmTask.hdnAdvancedTabValue.value != "")
  970.  
  971.             {
  972.  
  973.                 
  974.  
  975.                 for(i=0;i<document.frmTask.lstIP.length;i++)
  976.  
  977.                 {
  978.  
  979.                     arrIP = arrIP+ document.frmTask.lstIP.options[i].value + ";";
  980.  
  981.                 }
  982.  
  983.                 
  984.  
  985.                 for(i=0;i<document.frmTask.lstGATEWAY.length;i++)
  986.  
  987.                 {
  988.  
  989.                     arrGatewayIP = arrGatewayIP + document.frmTask.lstGATEWAY.options[i].value + ";";
  990.  
  991.                 }                                
  992.  
  993.                 arrIP = arrIP.substring(0,arrIP.length-1);
  994.  
  995.                 arrGatewayIP = arrGatewayIP.substring(0,arrGatewayIP.length-1);                
  996.  
  997.                 
  998.  
  999.                 document.frmTask.hdnlstIP.value = arrIP;
  1000.  
  1001.                 document.frmTask.hdnlstGATEWAY.value = arrGatewayIP;
  1002.  
  1003.                 
  1004.  
  1005.                 var OptionSel = "<%=F_strRadIP %>";                
  1006.  
  1007.                 if (OptionSel == 1)            
  1008.  
  1009.                 {                    
  1010.  
  1011.                     var arrIPValue;
  1012.  
  1013.                     var strIPValue;                                
  1014.  
  1015.                     if ( document.frmTask.lstGATEWAY.length == 0)    // checking for the blank gateway case 
  1016.                     {
  1017.                         SA_DisplayErr('<%=SA_EscapeQuotes(L_GATEWAY_ERRORMESSAGE)%>');
  1018.  
  1019.                         document.frmTask.onkeypress = ClearErr;                    
  1020.  
  1021.                         return false;
  1022.                     }
  1023.                     
  1024.                     if(document.frmTask.lstIP.length != 0)
  1025.  
  1026.                     {                
  1027.  
  1028.                         strIPValue = document.frmTask.lstIP[0].value;
  1029.  
  1030.                         arrIPValue = strIPValue.split(':');
  1031.  
  1032.                         document.frmTask.txtIP.value = arrIPValue[0];
  1033.  
  1034.                         document.frmTask.txtMask.value = arrIPValue[1];
  1035.  
  1036.                     
  1037.  
  1038.                         var arrGatewayValue;
  1039.  
  1040.                         arrGatewayValue = arrGatewayIP.split(' <%=L_METRIC_TEXT%> ');
  1041.  
  1042.                         document.frmTask.txtGateway.value = arrGatewayValue[0];
  1043.  
  1044.                     }
  1045.  
  1046.                     else if(document.frmTask.lstIP.length == 0)
  1047.  
  1048.                     {
  1049.  
  1050.                         document.frmTask.txtIP.value = "";
  1051.  
  1052.                         document.frmTask.txtMask.value = "";                    
  1053.  
  1054.                     }
  1055.  
  1056.                 }
  1057.  
  1058.             }    
  1059.  
  1060.             return true;
  1061.  
  1062.         }
  1063.  
  1064.  
  1065.  
  1066.         // SetData Function
  1067.  
  1068.         // --------------
  1069.  
  1070.         // This function is called by the Web Framework and is called
  1071.  
  1072.         // only if ValidatePage returned a success (true) code.
  1073.  
  1074.         function SetData()
  1075.  
  1076.         {
  1077.  
  1078.             return true;
  1079.  
  1080.         }
  1081.  
  1082.         </SCRIPT>
  1083.  
  1084. <%
  1085.  
  1086.     End Function
  1087.  
  1088.  
  1089.  
  1090.     '-------------------------------------------------------------------------
  1091.  
  1092.     'Function:                ServeCommonJavaScript
  1093.  
  1094.     'Description:            Serve common javascript that is required for this page type.
  1095.  
  1096.     'Input Variables:        None
  1097.  
  1098.     'Output Variables:        None
  1099.  
  1100.     'Returns:                None
  1101.  
  1102.     'Global Variables:        None
  1103.  
  1104.     '-------------------------------------------------------------------------
  1105.  
  1106.     Function ServeCommonJavaScript()
  1107.  
  1108.     %>
  1109.  
  1110.         <script language="JavaScript" src="<%=m_VirtualRoot%>inc_global.js">
  1111.  
  1112.         </script>
  1113.  
  1114.         <script language="JavaScript">
  1115.  
  1116.         //
  1117.  
  1118.         // Microsoft Server Appliance Web Framework Support Functions
  1119.  
  1120.         // Copyright (c) Microsoft Corporation.  All rights reserved. 
  1121.  
  1122.         //
  1123.  
  1124.  
  1125.  
  1126.         // Function to enable or disable controls of the General tab
  1127.  
  1128.         function enableIPControls(Flag)
  1129.  
  1130.         {    
  1131.  
  1132.             // Disable text boxes
  1133.  
  1134.             document.frmTask.txtIP.disabled=Flag;
  1135.  
  1136.             document.frmTask.txtMask.disabled=Flag;
  1137.  
  1138.             document.frmTask.txtGateway.disabled=Flag;
  1139.  
  1140.         }            
  1141.  
  1142.         
  1143.  
  1144.         //Function  to validate the Subnet mask and return true or false. 
  1145.  
  1146.         function isValidSubnetMask(objSubnetMask) 
  1147.  
  1148.         {
  1149.  
  1150.             var strMasktext = objSubnetMask.value;
  1151.  
  1152.             if (strMasktext.length == 0) 
  1153.  
  1154.                 return false;    // No subnet entered
  1155.  
  1156.                 
  1157.  
  1158.             // counts no of dots  by calling the function if it is less returns 0                        
  1159.  
  1160.             if ( countChars(strMasktext,".") != 3) 
  1161.  
  1162.             { 
  1163.  
  1164.                 // Invalid format
  1165.  
  1166.                 return false;
  1167.  
  1168.             }
  1169.  
  1170.             var arrMask = strMasktext.split(".");
  1171.  
  1172.             var i,j,blnValid ;
  1173.  
  1174.             
  1175.  
  1176.             for(i = 0; i < 4; i++)
  1177.  
  1178.             {
  1179.  
  1180.                 if ( (arrMask[i].length < 1 ) || (arrMask[i].length > 3 ) )
  1181.  
  1182.                 {
  1183.  
  1184.                     // Invalid format
  1185.  
  1186.                     return false;
  1187.  
  1188.                 }
  1189.  
  1190.                 if ( !isInteger(arrMask[i]))
  1191.  
  1192.                 {
  1193.  
  1194.                     // Invalid characters
  1195.  
  1196.                     return false;
  1197.  
  1198.                 }
  1199.  
  1200.                 arrMask[i] = parseInt(arrMask[i],10);
  1201.  
  1202.                 if (arrMask[i] > 255)
  1203.  
  1204.                 {
  1205.  
  1206.                     // Out of bounds
  1207.  
  1208.                     return false;
  1209.  
  1210.                 }
  1211.  
  1212.  
  1213.  
  1214.             }    // end of for loop
  1215.  
  1216.                 
  1217.  
  1218.             if ( arrMask[0] == 0 || arrMask[3] == 255)
  1219.  
  1220.             {
  1221.  
  1222.                 // mask must not start with 0 or end with 255
  1223.  
  1224.                 return false;                        
  1225.  
  1226.             }
  1227.  
  1228.             for(i=0;i<4;i++)
  1229.  
  1230.             {
  1231.  
  1232.                 if(arrMask[i] != 255) 
  1233.  
  1234.                 {
  1235.  
  1236.                     for(j=i+1 ; j<4; j++)
  1237.  
  1238.                     {
  1239.  
  1240.                         if (arrMask[j] != 0) 
  1241.  
  1242.                         {    // mask not contiguous
  1243.  
  1244.                             return false;                        
  1245.  
  1246.                         }
  1247.  
  1248.                     }// end of j for loop
  1249.  
  1250.                     blnValid = false;
  1251.  
  1252.                     for(j=1;j<9;j++)
  1253.  
  1254.                     {
  1255.  
  1256.                         if (arrMask[i] == (256-Math.pow(2, j)))
  1257.  
  1258.                             blnValid = true;
  1259.  
  1260.                     }
  1261.  
  1262.                     if(!blnValid)
  1263.  
  1264.                     {
  1265.  
  1266.                         // mask not contiguous
  1267.  
  1268.                         return false;                        
  1269.  
  1270.                     }        
  1271.  
  1272.                 }// end of     if(arrMask[i] != 255) 
  1273.  
  1274.             }// end of for loop
  1275.  
  1276.             objSubnetMask.value = arrMask.join(".");
  1277.  
  1278.             return true;
  1279.  
  1280.         }
  1281.  
  1282.         
  1283.  
  1284.         //Disable the controls related to Gateway when no items in Gateway listbox 
  1285.  
  1286.         function enableGatewayControls()
  1287.  
  1288.         {
  1289.  
  1290.             if(document.frmTask.lstGATEWAY.length==0) 
  1291.  
  1292.             {
  1293.  
  1294.                 document.frmTask.btnAddGATEWAY.disabled=true;
  1295.  
  1296.             }
  1297.  
  1298.             else
  1299.  
  1300.             {
  1301.  
  1302.                 document.frmTask.txtAdvGATEWAY.disabled = false;
  1303.  
  1304.                 document.frmTask.txtGATEWAYMetric.disabled = false;
  1305.  
  1306.                 document.frmTask.txtGATEWAYMetric.value = 1;
  1307.  
  1308.             }
  1309.  
  1310.         }
  1311.  
  1312.         
  1313.  
  1314.         //Disable the controls related to IP when no items in IP listbox 
  1315.  
  1316.         function enableAdvIPControls()
  1317.  
  1318.         {
  1319.  
  1320.             if(document.frmTask.lstIP.length==0) 
  1321.  
  1322.             {
  1323.  
  1324.                 document.frmTask.btnAddIP.disabled=true;
  1325.  
  1326.             }
  1327.  
  1328.             else
  1329.  
  1330.             {
  1331.  
  1332.                 document.frmTask.txtAdvIP.disabled = false;
  1333.  
  1334.                 document.frmTask.txtAdvMask.disabled = false;
  1335.  
  1336.             }
  1337.  
  1338.             
  1339.  
  1340.         }
  1341.  
  1342.     
  1343.  
  1344.         //Limits the length of listbox to a specified value and disables the appropriate textboxes 
  1345.  
  1346.         function LimitListLength(Obj,Objlen,ObjFirst,ObjSecond,ObjButton)
  1347.  
  1348.         {
  1349.  
  1350.             var lstIPLength = Obj.length;
  1351.  
  1352.  
  1353.  
  1354.             if(lstIPLength >= Objlen)
  1355.  
  1356.             {
  1357.  
  1358.                 ObjFirst.disabled = true;
  1359.  
  1360.                 ObjSecond.disabled = true;
  1361.  
  1362.                 ObjButton.disabled = true;
  1363.  
  1364.             }
  1365.  
  1366.         }        
  1367.  
  1368.  
  1369.  
  1370.         // Function to add the IP& subnet to the selected list box
  1371.  
  1372.         function addIPtoListBox(objLst,objFirst,objSecond,objRemove)
  1373.  
  1374.         {            
  1375.  
  1376.             var strIPANDSubnet=objFirst.value+":"+objSecond.value;
  1377.  
  1378.             
  1379.  
  1380.             //calling function to validate IP    
  1381.  
  1382.             var intResult=isValidIP(objFirst);
  1383.  
  1384.             if(intResult!=0)
  1385.  
  1386.             {
  1387.  
  1388.                 //Calling to validate the IP and display the error message
  1389.  
  1390.                 SA_DisplayErr('<%=SA_EscapeQuotes(L_IP_ERRORMESSAGE)%>');
  1391.  
  1392.                 document.frmTask.onkeypress = ClearErr;
  1393.  
  1394.                 selectFocus(objFirst);
  1395.  
  1396.                 return;
  1397.  
  1398.             }    
  1399.  
  1400.             //Checking for the SubnetMask validation 
  1401.  
  1402.             if (objSecond.value==""|| !isValidSubnetMask(objSecond))
  1403.  
  1404.             {
  1405.  
  1406.                 SA_DisplayErr('<%=SA_EscapeQuotes(L_INVALIDSUBNETADDRESSES_ERRORMESSAGE)%>');
  1407.  
  1408.                 document.frmTask.onkeypress = ClearErr;
  1409.  
  1410.                 selectFocus(objSecond);
  1411.  
  1412.                 return;
  1413.  
  1414.             }
  1415.  
  1416.             
  1417.  
  1418.             // checking for the duplicate values if not add to the list box
  1419.  
  1420.             if (!addToListBox(objLst,objRemove,strIPANDSubnet,strIPANDSubnet))
  1421.  
  1422.             {
  1423.  
  1424.                 SA_DisplayErr('<%=SA_EscapeQuotes(L_DUPLICATEADDRESSES_ERRORMESSAGE)%>');
  1425.  
  1426.                 document.frmTask.onkeypress = ClearErr;
  1427.  
  1428.             }
  1429.  
  1430.             else
  1431.  
  1432.             {
  1433.  
  1434.                 objFirst.value="";
  1435.  
  1436.                 objSecond.value="";
  1437.  
  1438.                 objFirst.focus();
  1439.  
  1440.                 // making the addIP button disable                
  1441.  
  1442.                 document.frmTask.btnAddIP.disabled=true;                
  1443.  
  1444.                 if(objLst.length >= 40)
  1445.  
  1446.                 {
  1447.  
  1448.                     objFirst.disabled = true;
  1449.  
  1450.                     objSecond.disabled = true;                    
  1451.  
  1452.                 }
  1453.  
  1454.             }
  1455.  
  1456.  
  1457.  
  1458.         }// end of function addIPtoListBox
  1459.  
  1460.         
  1461.  
  1462.         // to set the default subnetmask depending 
  1463.  
  1464.         // on the Class of IP address
  1465.  
  1466.         function setDefaultSubnet(objIP,objSubnet)
  1467.  
  1468.         {
  1469.  
  1470.             // get the IP and subnet values
  1471.  
  1472.             var strIPtext = objIP.value;
  1473.  
  1474.             var strSubnet = objSubnet.value;            
  1475.  
  1476.  
  1477.  
  1478.             // validate the IP address first
  1479.  
  1480.             var nRetval = isValidIP(objIP)
  1481.  
  1482.             if (nRetval!= 0)
  1483.  
  1484.             {
  1485.  
  1486.                 return; 
  1487.  
  1488.             }
  1489.  
  1490.  
  1491.  
  1492.             // return if the subnet already has some value 
  1493.  
  1494.             if(!(Trim(strSubnet) == ""))
  1495.  
  1496.             {
  1497.  
  1498.                 return;
  1499.  
  1500.             }
  1501.  
  1502.             
  1503.  
  1504.             // decide the class of IP to give the default Subnet
  1505.  
  1506.             var arrIP = strIPtext.split(".");
  1507.  
  1508.             var nClassId = parseInt(arrIP[0],10);
  1509.  
  1510.  
  1511.  
  1512.             // set the value of the subnet depending on the class
  1513.  
  1514.             if(nClassId <=126)
  1515.  
  1516.                objSubnet.value = "255.0.0.0";    // Class A
  1517.  
  1518.             else if(nClassId <=191)
  1519.  
  1520.                     objSubnet.value = "255.255.0.0";  // Class B
  1521.  
  1522.                  else if(nClassId < 255)
  1523.  
  1524.                          objSubnet.value = "255.255.255.0";  // Class C
  1525.  
  1526.             
  1527.  
  1528.             // set the focus on the subnet
  1529.  
  1530.             selectFocus(objSubnet);
  1531.  
  1532.         }
  1533.  
  1534.         
  1535.  
  1536.         // Function to add the Gateway & Gatewaymetric to the selected list box
  1537.  
  1538.         function addGATEWAYtoListBox(objLst,objFirst,objSecond,objRemove)
  1539.  
  1540.         {
  1541.  
  1542.             var strGatewayANDMetric=objFirst.value + " <%=L_METRIC_TEXT%> " + objSecond.value;
  1543.  
  1544.                 
  1545.  
  1546.             //calling function to validate GATEWAY        
  1547.  
  1548.             var intResult=isValidIP(objFirst)            
  1549.  
  1550.         
  1551.  
  1552.             if(intResult!=0)
  1553.  
  1554.             {
  1555.  
  1556.                 //Calling to validate the GATEWAY and display the error message
  1557.  
  1558.                 SA_DisplayErr('<%=SA_EscapeQuotes(L_IP_ERRORMESSAGE)%>');
  1559.  
  1560.                 document.frmTask.onkeypress = ClearErr;
  1561.  
  1562.                 selectFocus(objFirst);
  1563.  
  1564.                 return;
  1565.  
  1566.             }
  1567.  
  1568.             
  1569.  
  1570.             //Checking for the SubnetMask validation 
  1571.  
  1572.             if (objSecond.value=="" || !validateMetric(objSecond,
  1573.  
  1574.                     '<%=SA_EscapeQuotes(L_INVALIDGATEWAYMETRIC_ERRORMESSAGE)%>')) 
  1575.  
  1576.             {
  1577.  
  1578.                 SA_DisplayErr('<%=SA_EscapeQuotes(L_INVALIDGATEWAYMETRIC_ERRORMESSAGE)%>');
  1579.  
  1580.                 document.frmTask.onkeypress = ClearErr;
  1581.  
  1582.                 selectFocus(objSecond);
  1583.  
  1584.                 return;
  1585.  
  1586.             }
  1587.  
  1588.             // checking for the duplicate values if not add to the list box
  1589.  
  1590.             if (!addToListBox(objLst,objRemove,strGatewayANDMetric,strGatewayANDMetric))
  1591.  
  1592.             {
  1593.  
  1594.                 SA_DisplayErr('<%=SA_EscapeQuotes(L_DUPLICATEADDRESSES_ERRORMESSAGE)%>');
  1595.  
  1596.                 document.frmTask.onkeypress = ClearErr;
  1597.  
  1598.             }
  1599.  
  1600.             else
  1601.  
  1602.             {
  1603.  
  1604.                 objFirst.value="";
  1605.  
  1606.                 objSecond.value="";
  1607.  
  1608.                 objFirst.focus();
  1609.  
  1610.                 // making the addGATEWAY button disable
  1611.  
  1612.                 document.frmTask.btnAddGATEWAY.disabled=true;
  1613.  
  1614.                 objSecond.value=1; 
  1615.  
  1616.                 if(objLst.length >= 20)
  1617.  
  1618.                 {
  1619.  
  1620.                     objFirst.disabled = true;
  1621.  
  1622.                     objSecond.disabled = true;
  1623.  
  1624.                     objSecond.value = ""; 
  1625.  
  1626.                 }
  1627.  
  1628.             }
  1629.  
  1630.         }// end of function addGATEWAYtoListBox
  1631.  
  1632.         
  1633.  
  1634.         function validateMetric(objTxt,strErrorMsg)
  1635.  
  1636.         {
  1637.  
  1638.             if (objTxt.value=="" || objTxt.value==0 ||objTxt.value > 9999  )
  1639.  
  1640.             {
  1641.  
  1642.                 SA_DisplayErr(strErrorMsg);
  1643.  
  1644.                 document.frmTask.onkeypress = ClearErr;
  1645.  
  1646.                 // making the value null
  1647.  
  1648.                 objTxt.value="";
  1649.  
  1650.                 objTxt.focus();
  1651.  
  1652.                 return false;
  1653.  
  1654.             }    
  1655.  
  1656.             else
  1657.  
  1658.                 return true;
  1659.  
  1660.         }
  1661.  
  1662.         </script>
  1663.  
  1664.     <%
  1665.  
  1666.     End Function
  1667.  
  1668.     
  1669.  
  1670.     '-------------------------------------------------------------------------
  1671.  
  1672.     'Function:                ServeGeneralUI
  1673.  
  1674.     'Description:            Serves the HTML content for General tab
  1675.  
  1676.     'Input Variables:        None
  1677.  
  1678.     'Output Variables:        None
  1679.  
  1680.     'Returns:                None
  1681.  
  1682.     'Global Variables:        g_*, F_*, blnDHCPEnabled, L_*
  1683.  
  1684.     '-------------------------------------------------------------------------
  1685.  
  1686.     Function ServeGeneralUI()
  1687.  
  1688.  
  1689.  
  1690.         Call SA_TraceOut(SOURCE_FILE, "ServeGeneralUI")
  1691.         
  1692.         'check whether DHCP is enabled
  1693.  
  1694.         Dim objService        ' WMI connection object
  1695.         Dim objInstance        ' Adapter instance
  1696.         
  1697.         'Trying to connect to the server
  1698.  
  1699.         Set objService=GetWMIConnection(CONST_WMI_WIN32_NAMESPACE)                
  1700.  
  1701.  
  1702.         'Getting the instance of the particulat NIC card object 
  1703.  
  1704.         Set objInstance = getNetworkAdapterObject(objService,g_strDeviceID)
  1705.         
  1706.  
  1707.         ' Getting DHCP Enable/Disable and accordingly set radio values  
  1708.  
  1709.         blnDHCPEnabled = isDHCPenabled(objInstance)
  1710.  
  1711.         'Release the objects
  1712.         set objService =  nothing
  1713.         set objInstance = nothing
  1714.         
  1715.  
  1716.         if trim(g_strTabValue) = "" or blnDHCPEnabled then
  1717.  
  1718.             Call getDefaultGeneralValues() 'Get the default values for General tab
  1719.  
  1720.         end if
  1721.  
  1722.                         
  1723.  
  1724.             %>                        
  1725.  
  1726.             
  1727.  
  1728.             <TABLE  ALIGN=left BORDER=0 CELLSPACING=0 CELLPADDING=2>
  1729.  
  1730.             <TR>
  1731.  
  1732.                 <TD COLSPAN=2 nowrap class="TasksBody">
  1733.  
  1734.                     <INPUT TYPE="RADIO" CLASS="FormRadioButton" NAME="radIP" VALUE="IPDEFAULT" TABINDEX=1 <%If (blnDHCPEnabled) Then Response.Write " CHECKED" End If%> onClick="enableIPControls(true)" > <%=L_OBTAINIPFROMDHCP_TEXT %>
  1735.  
  1736.                 </TD>
  1737.  
  1738.             </TR>
  1739.  
  1740.             <TR>    
  1741.  
  1742.                 <TD COLSPAN=2 nowrap class="TasksBody">    
  1743.  
  1744.                     <INPUT TYPE="RADIO" CLASS="FormRadioButton" NAME="radIP" VALUE="IPMANUAL"  TABINDEX=1  <%If (Not blnDHCPEnabled) Then Response.Write " CHECKED" End If %> onClick="enableIPControls(false)" > <%=L_CONFIGUREMANUALLY_TEXT%>
  1745.  
  1746.                 </TD>
  1747.  
  1748.             </TR>
  1749.  
  1750.             <TR>
  1751.  
  1752.                 <TD COLSPAN=2 class="TasksBody">
  1753.  
  1754.                     <P> </P>
  1755.  
  1756.                 </TD>
  1757.  
  1758.             </TR>            
  1759.  
  1760.             <TR>
  1761.  
  1762.                 <TD ALIGN=LEFT nowrap class="TasksBody">
  1763.  
  1764.                           <%=L_NIC_IP_IP%>
  1765.  
  1766.                 </TD>
  1767.  
  1768.                 <TD ALIGN=left class="TasksBody">
  1769.  
  1770.                     <%                        
  1771.                         select case blnDHCPEnabled
  1772.  
  1773.                             case false
  1774.  
  1775.                     %>
  1776.  
  1777.                                 <INPUT CLASS='FormField' TYPE="TEXT" NAME="txtIP" VALUE="<%=F_strIPAddress %>" TABINDEX=2  MAXLENGTH=15 OnKeyPress="if(window.event.keyCode == 13) return true ; checkKeyforIPAddress(this);">
  1778.  
  1779.                                 
  1780.  
  1781.                         <%
  1782.  
  1783.                             case true
  1784.  
  1785.                         %>
  1786.  
  1787.                                 <INPUT CLASS='FormField' TYPE="TEXT" NAME="txtIP" VALUE="<%=F_strIPAddress %>" disabled TABINDEX=2  MAXLENGTH=15 OnKeyPress="if(window.event.keyCode == 13) return true ; checkKeyforIPAddress(this);">
  1788.  
  1789.                             <%
  1790.  
  1791.                         end select
  1792.  
  1793.                             %>
  1794.  
  1795.                 </TD>                
  1796.  
  1797.             </TR>
  1798.  
  1799.             <TR>
  1800.  
  1801.                 <TD ALIGN=LEFT nowrap class="TasksBody">
  1802.  
  1803.                           <%=L_SUBNETMASK_TEXT%>
  1804.  
  1805.                 </TD>
  1806.  
  1807.                 <TD ALIGN=left class="TasksBody">
  1808.  
  1809.                     <%
  1810.  
  1811.                         select case blnDHCPEnabled
  1812.  
  1813.                             case false
  1814.  
  1815.                     %>
  1816.  
  1817.                                 <INPUT CLASS='FormField' TYPE="TEXT" NAME="txtMask" VALUE="<%=F_strSubnetMask%>"  TABINDEX=3 MAXLENGTH=15 OnKeyPress=" if(window.event.keyCode == 13) return true ; checkKeyforIPAddress(this);">
  1818.  
  1819.                     <%
  1820.  
  1821.                             case true
  1822.  
  1823.                     %>            
  1824.  
  1825.                                 <INPUT CLASS='FormField' TYPE="TEXT" NAME="txtMask"  VALUE="<%=F_strSubnetMask%>" disabled TABINDEX=3 MAXLENGTH=15 OnKeyPress=" if(window.event.keyCode == 13) return true ; checkKeyforIPAddress(this);">
  1826.  
  1827.                     <%
  1828.  
  1829.                         end select
  1830.  
  1831.                     %>
  1832.  
  1833.  
  1834.  
  1835.                 </TD>
  1836.  
  1837.             </TR>
  1838.  
  1839.             <TR>
  1840.  
  1841.                 <TD ALIGN=left nowrap class="TasksBody">
  1842.  
  1843.                           <%=L_DEFAULTGATEWAY_TEXT%>
  1844.  
  1845.                 </TD>
  1846.  
  1847.                 <TD ALIGN=left class="TasksBody">    
  1848.  
  1849.                     <%
  1850.  
  1851.                         select case blnDHCPEnabled
  1852.  
  1853.                             case false
  1854.  
  1855.                     %>        
  1856.  
  1857.                                 <INPUT CLASS='FormField' TYPE="TEXT" NAME="txtGateway" VALUE="<%=F_strGatewayAddress%>" TABINDEX=3 MAXLENGTH=15 OnKeyPress=" if(window.event.keyCode == 13) return true ; checkKeyforIPAddress(this);">
  1858.  
  1859.                     <%
  1860.  
  1861.                             case true
  1862.  
  1863.                     %>            
  1864.  
  1865.                                 <INPUT CLASS='FormField' TYPE="TEXT" DISABLED NAME="txtGateway" VALUE="<%=F_strGatewayAddress%>" TABINDEX=3 MAXLENGTH=15 OnKeyPress=" if(window.event.keyCode == 13) return true ; checkKeyforIPAddress(this);">
  1866.  
  1867.                     <%
  1868.  
  1869.                             end select
  1870.  
  1871.                     %>
  1872.  
  1873.  
  1874.  
  1875.                 </TD>
  1876.  
  1877.             </TR>            
  1878.  
  1879.             </TABLE>
  1880.  
  1881.             <INPUT TYPE=hidden NAME=hdnGeneralTabValue VALUE="">
  1882.             
  1883.             <INPUT TYPE=hidden NAME=hdnInitialIPValue VALUE="<%= g_initialIPAddress  %>">
  1884.  
  1885.             <INPUT TYPE=hidden NAME=hdnRadIP VALUE="">
  1886.  
  1887.         <%
  1888.     
  1889.  
  1890.     End Function    
  1891.  
  1892.  
  1893.  
  1894.     '-------------------------------------------------------------------------
  1895.  
  1896.     'Function:                ServeAdvancedUI
  1897.  
  1898.     'Description:            Serves the HTML content for Advanced tab
  1899.  
  1900.     'Input Variables:        None
  1901.  
  1902.     'Output Variables:        None
  1903.  
  1904.     'Returns:                None
  1905.  
  1906.     'Global Variables:        g_*, F_*, L_*
  1907.  
  1908.     '-------------------------------------------------------------------------    
  1909.  
  1910.     Function ServeAdvancedUI()
  1911.  
  1912.         
  1913.  
  1914.         Call SA_TraceOut(SOURCE_FILE, "ServeAdvancedUI")        
  1915.  
  1916.         
  1917.  
  1918.         if trim(g_strAdvTabValue) = "" then
  1919.  
  1920.             getDefaultAdvancedvalues()    'Get the default values for Advanced tab
  1921.  
  1922.         else        
  1923.  
  1924.             UpdateDefaultValues()    'Update the values when navigated between tabs
  1925.  
  1926.         end if
  1927.  
  1928.  
  1929.  
  1930.         %>
  1931.  
  1932.             
  1933.  
  1934.         <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 class="TasksBody">
  1935.  
  1936.             <TR>
  1937.  
  1938.                 <TD NOWRAP class="TasksBody" >
  1939.  
  1940.                     <P><%=L_NIC_IP_IP%></P>
  1941.  
  1942.                 </TD>    
  1943.                 
  1944.                 
  1945.                 <TD class="TasksBody">
  1946.                 
  1947.                 
  1948.                 </TD>
  1949.                 
  1950.                 <TD VALIGN=TOP nowrap rowspan=2 class="TasksBody" >
  1951.                     
  1952.                     <BR>                    
  1953.                     <%=L_NIC_IP_IP%><BR>
  1954.  
  1955.                     <INPUT CLASS='FormField' TYPE="TEXT" NAME="txtAdvIP" VALUE="" TABINDEX=3 SIZE=20 MAXLENGTH=15 OnKeyPress="checkKeyforIPAddress(this)" onKeyUP="disableAddButton(this,btnAddIP)">
  1956.  
  1957.                     <BR>
  1958.  
  1959.                     <%=L_ADVSUBNETMASK_TEXT%><BR>
  1960.  
  1961.                     <INPUT CLASS='FormField' TYPE="TEXT" NAME="txtAdvMask" VALUE="" TABINDEX=5 SIZE=20 MAXLENGTH=15 OnKeyPress="checkKeyforIPAddress(this);" onfocus="setDefaultSubnet(txtAdvIP,this);">
  1962.  
  1963.                 </TD>
  1964.                 
  1965.  
  1966.             </TR>
  1967.  
  1968.             <TR>            
  1969.  
  1970.                 <TD class="TasksBody" width=23%>
  1971.  
  1972.                     <SELECT NAME="lstIP" style="width=225px" class="FormField" TABINDEX=2 SIZE=7 >
  1973.  
  1974. <%                                    
  1975.  
  1976.                     'Function call to add the IP Addresses and Subnet masks to the List box and limit the size to 40
  1977.  
  1978.                     ServeListValues g_arrIPList,L_SERVEVALUES_ERRORMESSAGE, 40
  1979.  
  1980. %>                
  1981.  
  1982.                     </SELECT>
  1983.  
  1984.                 </TD>                
  1985.  
  1986.                 <TD  class="TasksBody" ALIGN=center width=23%>
  1987.  
  1988.                     <% Call SA_ServeOnClickButtonEx(L_BUTTON_ADD_TEXT,"","addIPtoListBox(lstIP,txtAdvIP,txtAdvMask,btnRemoveIP)",90,0,"DISABLED","btnAddIP")%>
  1989.  
  1990.                     <BR><BR><BR><BR>
  1991.                     
  1992.                     <% Call SA_ServeOnClickButtonEx(L_BUTTON_REMOVE_TEXT,"","removeListBoxItems(lstIP,btnRemoveIP);enableAdvIPControls()",90,0,"ENABLED","btnRemoveIP")%>
  1993.  
  1994.                 </TD>
  1995.  
  1996.                 
  1997.             </TR>            
  1998.  
  1999.             <TR>
  2000.         
  2001.                 <TD class="TasksBody" NOWRAP COLSPAN="3" ><BR><p><%=L_GATEWAYADDRESS_TEXT%></P></TD>
  2002.  
  2003.             </TR>    
  2004.  
  2005.             <TR>                
  2006.  
  2007.                 <TD class="TasksBody">
  2008.  
  2009.                     <SELECT NAME="lstGATEWAY" class="FormField" style="width=225px" TABINDEX=7 SIZE=6>
  2010.  
  2011. <%                
  2012.  
  2013.                     'Function call to add the Gateway Addresses and Metric to the List box  and limit the size to 20
  2014.  
  2015.                     ServeListValues g_arrGATEWAYList,L_SERVEVALUES_ERRORMESSAGE, 20
  2016.  
  2017. %>                
  2018.  
  2019.                     </SELECT>
  2020.  
  2021.                 </TD>
  2022.  
  2023.                 <TD  class="TasksBody" ALIGN=center >
  2024.  
  2025.                     <% Call SA_ServeOnClickButtonEx(L_BUTTON_ADD_TEXT,"","addGATEWAYtoListBox(lstGATEWAY,txtAdvGATEWAY,txtGATEWAYMetric,btnRemoveGATEWAY)",90,0,"DISABLED","btnAddGATEWAY")%>
  2026.  
  2027.                     <BR><BR><BR><BR>
  2028.  
  2029.                     <% Call SA_ServeOnClickButtonEx(L_BUTTON_REMOVE_TEXT,"","removeListBoxItems(lstGATEWAY,btnRemoveGATEWAY); enableGatewayControls();",90,0,"ENABLED","btnRemoveGATEWAY")%>
  2030.  
  2031.                 </TD>
  2032.  
  2033.                 <TD nowrap class="TasksBody">
  2034.  
  2035.                     <%=L_GATEWAY_TEXT %><BR>
  2036.  
  2037.                     <INPUT CLASS='FormField' TYPE="TEXT" NAME="txtAdvGATEWAY" VALUE="" TABINDEX=8  SIZE=20 MAXLENGTH=15  OnKeyPress="checkKeyforIPAddress(this)" OnKeyUP="disableAddButton(this,btnAddGATEWAY)">
  2038.  
  2039.                     <BR>
  2040.  
  2041.                     <%=L_GATEWAYMETRIC_TEXT%><br>
  2042.  
  2043.                     <INPUT CLASS='FormField' TYPE="TEXT" NAME="txtGATEWAYMetric" TABINDEX=9 VALUE="" SIZE=6 MAXLENGTH=4 OnKeyPress="checkKeyforNumbers(this)">
  2044.  
  2045.                 </TD>
  2046.  
  2047.             </TR>
  2048.  
  2049.             <TR>            
  2050.  
  2051.                 <TD COLSPAN=3 class="TasksBody" nowrap   TITLE="<%=L_METRICDESC_TEXT%>"><BR><%=L_IPCONNECTIONMETRIC_TEXT%>
  2052.  
  2053.                 <INPUT TYPE="TEXT" NAME="txtConnectionMetric" TABINDEX=12 SIZE=15 MAXLENGTH=4 VALUE="<%=F_nConnectionMetric%>" OnKeyPress="checkKeyforNumbers(this)">
  2054.  
  2055.                 </TD>                
  2056.  
  2057.             </TR>        
  2058.  
  2059.             <TR>            
  2060.  
  2061.                 <TD COLSPAN=3 class="TasksBody">
  2062.  
  2063.                 <%= L_METRICDESC_TEXT %>
  2064.  
  2065.                 </TD>                
  2066.  
  2067.             </TR>
  2068.  
  2069.         </TABLE>
  2070.  
  2071.         <INPUT TYPE=hidden NAME=hdnlstIP VALUE="<%=F_strListIP%>">
  2072.  
  2073.         <INPUT TYPE=hidden NAME=hdnlstGATEWAY VALUE="<%=F_strListGateway%>">
  2074.  
  2075.         <INPUT TYPE=hidden NAME=hdnAdvancedTabValue VALUE="<%= g_strAdvTabValue %>">
  2076.         
  2077.         <INPUT TYPE=hidden NAME=hdnInitialIPValue VALUE="<%= g_initialIPAddress  %>">
  2078.  
  2079.     <%        
  2080.  
  2081.     
  2082.  
  2083.     End Function
  2084.  
  2085.     
  2086.  
  2087.     '-------------------------------------------------------------------------
  2088.  
  2089.     'Sub routine name:    ServeListValues
  2090.  
  2091.     'Description:        Serves in Loading the IP's/Gateways into the list box 
  2092.  
  2093.     'Input Variables:    In - strList->list of the addresses with concatination 
  2094.  
  2095.     '                           character as ; 
  2096.  
  2097.     '                    In - ERRORMESSAGE->Error message for that particular call
  2098.  
  2099.     'Output Variables:    None
  2100.  
  2101.     'Returns:            None
  2102.  
  2103.     'Global Variables:    None
  2104.  
  2105.     '-------------------------------------------------------------------------
  2106.  
  2107.     Sub ServeListValues(strList,ERRORMESSAGE,nMaxcount)
  2108.  
  2109.         
  2110.  
  2111.         Err.Clear
  2112.  
  2113.         On Error Resume Next
  2114.  
  2115.         
  2116.  
  2117.         Dim arrTempList        'holds the array of items
  2118.  
  2119.         Dim i                'holds the increment count
  2120.  
  2121.         Dim nCountVal        'holds the count of items to limit the items in the listbox
  2122.  
  2123.         
  2124.  
  2125.         Call SA_TraceOut(SOURCE_FILE, "ServeListValues")
  2126.  
  2127.  
  2128.  
  2129.         ' splitting the string into array
  2130.  
  2131.         arrTempList=split(strList,";",-1,1)
  2132.  
  2133.         nCountVal =0
  2134.  
  2135.         
  2136.  
  2137.         'Printing the array values into the listbox 
  2138.  
  2139.         For i=Lbound(arrTempList) To Ubound(arrTempList)   
  2140.  
  2141.             nCountVal = nCountVal + 1
  2142.  
  2143.             ' checking for empty and if the string is ":" dont display in the list box            
  2144.  
  2145.             If arrTempList(i) <> "" AND arrTempList(i) <> ":" Then
  2146.  
  2147.                 If i=Lbound(arrTempList) Then
  2148.  
  2149.                     Response.Write "<OPTION VALUE=" & chr(34) & arrTempList(i)_
  2150.  
  2151.                      & chr(34)& " SELECTED>" & arrTempList(i)  &  " </OPTION>"    
  2152.  
  2153.                 Else
  2154.  
  2155.                     Response.Write "<OPTION VALUE=" & chr(34) & arrTempList(i)_
  2156.  
  2157.                      & chr(34)& " >" & arrTempList(i)  &  " </OPTION>"    
  2158.  
  2159.                 End if
  2160.  
  2161.             End If
  2162.  
  2163.             if nCountVal = nMaxcount then exit for
  2164.  
  2165.         Next
  2166.  
  2167.         
  2168.  
  2169.         If Err.number <> 0 Then 
  2170.  
  2171.             Call SA_TraceOut(SOURCE_FILE, "ServeListValues failed")
  2172.  
  2173.             SA_SetErrMsg ERRORMESSAGE & "(" & Hex(Err.Number) & ")"    
  2174.  
  2175.         End If
  2176.  
  2177.     
  2178.  
  2179.     End Sub
  2180.  
  2181.     
  2182.  
  2183.     '-------------------------------------------------------------------------
  2184.  
  2185.     'Function name:        getDefaultGeneralValues
  2186.  
  2187.     'Description:        Serves in Getting the Default values from the System  
  2188.  
  2189.     'Input Variables:    None    
  2190.  
  2191.     'Output Variables:    None
  2192.  
  2193.     'Returns:            True/False
  2194.  
  2195.     'Global Variables:    In:G_CONST_REGISTRY_PATH-Reg path
  2196.  
  2197.     '                    In:CONST_WMI_WIN32_NAMESPACE
  2198.  
  2199.     '                    In:L_*                -Localized strings
  2200.  
  2201.     '                    Out:F_* - Form variables
  2202.  
  2203.     '
  2204.  
  2205.     'Called several functions regConnection,
  2206.  
  2207.     'getNetworkAdapterObject,isDHCPenabled,getRegkeyvalue
  2208.  
  2209.     'which will be helpful in getting the NIC information 
  2210.  
  2211.     '-------------------------------------------------------------------------
  2212.  
  2213.     Function getDefaultGeneralValues()
  2214.  
  2215.         Err.Clear
  2216.  
  2217.         On Error Resume Next
  2218.  
  2219.         
  2220.  
  2221.         Dim objService
  2222.  
  2223.         Dim objInstance                
  2224.  
  2225.         Dim arrIPList            'hold array IP list
  2226.  
  2227.         Dim arrSubnetList        'hold array Subnet list
  2228.  
  2229.         Dim nCount
  2230.  
  2231.         Dim strSettingID        'hold setting id
  2232.  
  2233.         Dim arrGATEWAYList        'hold gateway array list    
  2234.  
  2235.         Dim objRegistry
  2236.  
  2237.         Call SA_TraceOut(SOURCE_FILE, "getDefaultGeneralValues")
  2238.  
  2239.         
  2240.  
  2241.         'Trying to connect to the server
  2242.  
  2243.         Set objService=GetWMIConnection(CONST_WMI_WIN32_NAMESPACE)                
  2244.  
  2245.         'Connect to registry
  2246.         
  2247.         Set objRegistry=regConnection()
  2248.  
  2249.         'Getting the instance of the particulat NIC card object 
  2250.  
  2251.         Set objInstance = getNetworkAdapterObject(objService,g_strDeviceID)
  2252.  
  2253.         
  2254.  
  2255.         ' Getting DHCP Enable/Disable and accordingly set radio values  
  2256.  
  2257.         blnDHCPEnabled = isDHCPenabled(objInstance)
  2258.  
  2259.         
  2260.  
  2261.         'Getting the SettingID
  2262.  
  2263.         strSettingID=objInstance.SettingID
  2264.         
  2265.  
  2266.         'Getting IP values  from the registry  by giving the complete path
  2267.         
  2268.         arrIPList = objInstance.IPAddress
  2269.             
  2270.  
  2271.         'Getting subnet values  from the registry  by giving the complete path
  2272.          
  2273.          arrSubnetList = objInstance.IPSubnet
  2274.  
  2275.          
  2276.  
  2277.         'Getting GATEWAY values  from the registry  by giving the complete path
  2278.  
  2279.         arrGATEWAYList=getRegkeyvalue(objRegistry,G_CONST_REGISTRY_PATH & "\" _ 
  2280.  
  2281.         & strSettingID,"DefaultGateway",CONST_MULTISTRING)
  2282.  
  2283.     
  2284.         'Forming the string of IP+ SubnetMask list                    
  2285.  
  2286.         For nCount=LBound(arrIPList)  To UBound(arrIPList)
  2287.  
  2288.         
  2289.  
  2290.             F_strIPAddress = arrIPList(nCount)
  2291.             
  2292.             g_initialIPAddress = arrIPList(nCount)
  2293.  
  2294.             F_strSubnetMask = arrSubnetList(nCount)
  2295.  
  2296.             F_strGatewayAddress = arrGATEWAYList(nCount)
  2297.  
  2298.             Exit for
  2299.             
  2300.  
  2301.         Next
  2302.  
  2303.  
  2304.         getDefaultGeneralValues = true
  2305.  
  2306.         
  2307.  
  2308.         'release objects
  2309.  
  2310.         Set objInstance = Nothing
  2311.  
  2312.         Set objService  = Nothing
  2313.  
  2314.         Set objRegistry = Nothing
  2315.         
  2316.     End Function
  2317.  
  2318.     
  2319.  
  2320.     '-------------------------------------------------------------------------
  2321.  
  2322.     'Function name:        getDefaultAdvancedvalues
  2323.  
  2324.     'Description:        Serves in Getting the Default values from the System  
  2325.  
  2326.     'Input Variables:    None    
  2327.  
  2328.     'Output Variables:    None
  2329.  
  2330.     'Returns:            True/False
  2331.  
  2332.     'Global Variables:    In:G_CONST_REGISTRY_PATH-Reg path
  2333.  
  2334.     '                    Out:F_nConnectionMetric-IP connection
  2335.  
  2336.     '                        metric(from Registry)
  2337.  
  2338.     '                    Out:g_arrIPList-List of Ips& subnetmask
  2339.  
  2340.     '                    Out:G_arrGATEWAYList-List of Gateways& Metrics
  2341.  
  2342.     '                    In :L_*                -Localized strings
  2343.  
  2344.     '
  2345.  
  2346.     'Called several functions regConnection,
  2347.  
  2348.     'getNetworkAdapterObject,isDHCPenabled,getRegkeyvalue
  2349.  
  2350.     'which will be helpful in getting the NIC information 
  2351.  
  2352.     '-------------------------------------------------------------------------
  2353.  
  2354.     Function getDefaultAdvancedvalues()
  2355.  
  2356.         Err.Clear
  2357.  
  2358.         On Error Resume Next
  2359.  
  2360.         
  2361.  
  2362.         Dim objInstance            
  2363.  
  2364.         Dim objRegistry
  2365.  
  2366.         Dim objService                'holds WMI Connection 
  2367.  
  2368.         Dim arrIPList                'holds IP array list
  2369.  
  2370.         Dim arrSubnetList            'holds subnet array
  2371.  
  2372.         Dim arrGATEWAYList            'holds gateway array 
  2373.  
  2374.         Dim arrGATEWAYMetricList    'holds gateway metric list    
  2375.  
  2376.         Dim strSettingID            'holds setting ID
  2377.  
  2378.         Dim nCount        
  2379.  
  2380.         
  2381.  
  2382.         g_strAdvTabValue = "true"
  2383.  
  2384.  
  2385.  
  2386.         Call SA_TraceOut(SOURCE_FILE, "getDefaultAdvancedvalues")        
  2387.  
  2388.         
  2389.  
  2390.         'Trying to connect to the server
  2391.  
  2392.         Set objService=GetWMIConnection(CONST_WMI_WIN32_NAMESPACE)
  2393.  
  2394.         if Err.number <> 0 then
  2395.  
  2396.             SA_ServeFailurePage L_WMI_CONNECTIONFAIL_ERRORMESSAGE
  2397.  
  2398.             getDefaultAdvancedvalues = False
  2399.  
  2400.             Exit Function
  2401.  
  2402.         end if    
  2403.  
  2404.         
  2405.  
  2406.         'Connecting to default namespace to carry registry operations
  2407.  
  2408.         Set objRegistry=regConnection()
  2409.  
  2410.         If (objRegistry is Nothing) Then
  2411.  
  2412.             SA_ServeFailurePage L_SERVERCONNECTIONFAIL_ERRORMESSAGE
  2413.  
  2414.             getDefaultAdvancedvalues = False
  2415.  
  2416.             Exit Function
  2417.  
  2418.         End If
  2419.  
  2420.         
  2421.  
  2422.         'Getting the instance of the particulat NIC card object 
  2423.  
  2424.         Set objInstance = getNetworkAdapterObject(objService,g_strDeviceID)
  2425.  
  2426.         
  2427.  
  2428.         'Getting the SettingID
  2429.  
  2430.         strSettingID=objInstance.SettingID
  2431.  
  2432.             
  2433.  
  2434.         
  2435.  
  2436.         'Getting IP values  from the registry  by giving the complete path
  2437.  
  2438.         'arrIPList=getRegkeyvalue(objRegistry,G_CONST_REGISTRY_PATH & "\" _
  2439.  
  2440.         '& strSettingID,"IPAddress",CONST_MULTISTRING)        
  2441.         
  2442.         arrIPList = objInstance.IPAddress
  2443.  
  2444.         
  2445.  
  2446.             
  2447.  
  2448.         'Getting subnet values  from the registry  by giving the complete path
  2449.  
  2450.         'arrSubnetList=getRegkeyvalue(objRegistry,G_CONST_REGISTRY_PATH & "\" _
  2451.  
  2452.          '& strSettingID,"SubnetMask",CONST_MULTISTRING)
  2453.          
  2454.          arrSubnetList = objInstance.IPSubnet
  2455.  
  2456.                 
  2457.  
  2458.         if trim(F_strIPAddress) <> "" then 
  2459.  
  2460.             g_arrIPList = F_strIPAddress & ":" & F_strSubnetMask & ";" 
  2461.  
  2462.         
  2463.  
  2464.             'Forming the string of IP+ SubnetMask list
  2465.  
  2466.             For nCount=LBound(arrIPList) + 1 To UBound(arrIPList)
  2467.  
  2468.                 g_arrIPList=g_arrIPList+arrIPList(nCount)+":"+arrSubnetList(nCount)+";"
  2469.  
  2470.             Next
  2471.  
  2472.         
  2473.  
  2474.         else
  2475.  
  2476.             'Forming the string of IP+ SubnetMask list
  2477.  
  2478.             if F_strRadIP = 1 then                        
  2479.  
  2480.                 For nCount=LBound(arrIPList)+1  To UBound(arrIPList)
  2481.  
  2482.                     g_arrIPList=g_arrIPList+arrIPList(nCount)+":"+arrSubnetList(nCount)+";"
  2483.  
  2484.                 Next    
  2485.  
  2486.             end if    
  2487.  
  2488.             
  2489.  
  2490.             if F_strRadIP = 0 then                        
  2491.  
  2492.                 For nCount=LBound(arrIPList) To UBound(arrIPList)
  2493.  
  2494.                     g_arrIPList=g_arrIPList+arrIPList(nCount)+":"+arrSubnetList(nCount)+";"
  2495.  
  2496.                 Next    
  2497.  
  2498.             end if    
  2499.  
  2500.             
  2501.  
  2502.             
  2503.  
  2504.         end if
  2505.  
  2506.         
  2507.  
  2508.         'Getting GATEWAY values  from the registry  by giving the complete path
  2509.  
  2510.         arrGATEWAYList=getRegkeyvalue(objRegistry,G_CONST_REGISTRY_PATH & "\" _ 
  2511.  
  2512.         & strSettingID,"DefaultGateway",CONST_MULTISTRING)
  2513.  
  2514.         
  2515.  
  2516.                 
  2517.  
  2518.         'Getting GateWayCostMetric from registry  by giving the complete path
  2519.  
  2520.         arrGATEWAYMetricList =getRegkeyvalue(objRegistry,G_CONST_REGISTRY_PATH _
  2521.  
  2522.         & "\" & strSettingID,"DefaultGatewayMetric",CONST_MULTISTRING)
  2523.  
  2524.  
  2525.  
  2526.         if F_strRadIP <> 0 then
  2527.  
  2528.             if F_strGatewayAddress <> "" then g_arrGATEWAYList = F_strGatewayAddress & " "+L_METRIC_TEXT+" 1;"
  2529.  
  2530.                 
  2531.  
  2532.             'Forming the string of gateway+ metric list                
  2533.  
  2534.             For nCount=LBound(arrGATEWAYList) + 1 To UBound(arrGATEWAYList)
  2535.  
  2536.                 g_arrGATEWAYList = g_arrGATEWAYList+arrGATEWAYList(nCount)+ _
  2537.  
  2538.                                         " "+L_METRIC_TEXT+" "+arrGATEWAYMetricList(nCount)+";"
  2539.  
  2540.             Next
  2541.  
  2542.         else
  2543.  
  2544.             'Forming the string of gateway+ metric list                
  2545.  
  2546.             For nCount=LBound(arrGATEWAYList) To UBound(arrGATEWAYList)
  2547.  
  2548.                 g_arrGATEWAYList = g_arrGATEWAYList+arrGATEWAYList(nCount)+ _
  2549.  
  2550.                                         " "+L_METRIC_TEXT+" "+arrGATEWAYMetricList(nCount)+";"
  2551.  
  2552.             Next
  2553.  
  2554.         end if
  2555.  
  2556.  
  2557.  
  2558.             
  2559.  
  2560.         'Getting InterfaceMetric from the registry  by giving the complete path
  2561.  
  2562.         F_nConnectionMetric=getRegkeyvalue(objRegistry,G_CONST_REGISTRY_PATH _
  2563.  
  2564.         & "\" & strSettingID ,"InterfaceMetric",CONST_DWORD) 
  2565.  
  2566.             
  2567.  
  2568.         'Set to Nothing
  2569.  
  2570.         Set objService=Nothing
  2571.  
  2572.         Set objRegistry=Nothing
  2573.  
  2574.         Set objInstance=Nothing
  2575.  
  2576.         
  2577.  
  2578.         getDefaultAdvancedvalues = true
  2579.  
  2580.         
  2581.  
  2582.     End Function
  2583.  
  2584.     
  2585.  
  2586.     '-------------------------------------------------------------------------
  2587.  
  2588.     'Function:                UpdateDefaultValues
  2589.  
  2590.     'Description:            Updates the state of fields when navigated from one tab 
  2591.  
  2592.     '                        to another
  2593.  
  2594.     'Input Variables:        None
  2595.  
  2596.     'Output Variables:        None
  2597.  
  2598.     'Returns:                string
  2599.  
  2600.     'Global Variables:        F_*,g_*
  2601.  
  2602.     '-------------------------------------------------------------------------
  2603.  
  2604.     Function UpdateDefaultValues()
  2605.  
  2606.     
  2607.  
  2608.         Dim arrTempList 'holds temporary array
  2609.  
  2610.         Dim i            'holds increment count
  2611.  
  2612.         
  2613.  
  2614.         Call SA_TraceOut(SOURCE_FILE, "UpdateDefaultValues")
  2615.  
  2616.         
  2617.  
  2618.         arrTempList=split(F_strListGateway,";",-1,1)
  2619.  
  2620.         
  2621.  
  2622.         if F_strRadIP = 1 then
  2623.  
  2624.             if F_strGatewayAddress <> "" then g_arrGATEWAYList = F_strGatewayAddress & " "+L_METRIC_TEXT+" 1;"            
  2625.  
  2626.             For i=Lbound(arrTempList)+ 1 To Ubound(arrTempList)
  2627.  
  2628.                 g_arrGATEWAYList = g_arrGATEWAYList & arrTempList(i) & ";"
  2629.  
  2630.             next
  2631.  
  2632.             
  2633.  
  2634.         end if
  2635.  
  2636.             
  2637.  
  2638.         if F_strRadIP = 0 then
  2639.  
  2640.             For i=Lbound(arrTempList) To Ubound(arrTempList)
  2641.  
  2642.                 g_arrGATEWAYList = g_arrGATEWAYList & arrTempList(i) & ";"
  2643.  
  2644.             next
  2645.  
  2646.         End if
  2647.  
  2648.                         
  2649.  
  2650.         arrTempList=split(F_strListIP,";",-1,1)
  2651.  
  2652.             
  2653.  
  2654.         if F_strIPAddress <> "" then 
  2655.  
  2656.             
  2657.  
  2658.             g_arrIPList = F_strIPAddress & ":" & F_strSubnetMask & ";"
  2659.  
  2660.                 
  2661.  
  2662.             if F_strRadIP = 1 then
  2663.  
  2664.                 For i=Lbound(arrTempList)+ 1 To Ubound(arrTempList)
  2665.  
  2666.                     g_arrIPList = g_arrIPList & arrTempList(i) & ";"                 
  2667.  
  2668.                 next
  2669.  
  2670.             end if                
  2671.  
  2672.             
  2673.  
  2674.         elseif F_strIPAddress = "" then                 
  2675.  
  2676.             if F_strRadIP = 0 then
  2677.  
  2678.                 For i=Lbound(arrTempList) To Ubound(arrTempList)
  2679.  
  2680.                     g_arrIPList = g_arrIPList & arrTempList(i) & ";"                 
  2681.  
  2682.                 next
  2683.  
  2684.             end if    
  2685.  
  2686.             
  2687.  
  2688.         end if
  2689.  
  2690.             
  2691.  
  2692.     End Function
  2693.  
  2694.         
  2695.  
  2696.     '-------------------------------------------------------------------------
  2697.  
  2698.     'Function name:                setNIC
  2699.  
  2700.     'Description:                serves in Setting new IP & gateway values
  2701.  
  2702.     'Input Variables:            None
  2703.  
  2704.     'Output Variables:        
  2705.  
  2706.     'Returns:                    Boolean    - Returns ( True/Flase )
  2707.  
  2708.     'Global Variables:        In - blnDHCPEnabled        -Radio button value
  2709.  
  2710.     '                       In - G_CONST_REGISTRY_PATH -Reg path
  2711.  
  2712.     '                       In - L_* - Localized strings
  2713.  
  2714.     'Called registry related functions to update the values and displays the 
  2715.  
  2716.     'corresponding error if any.     
  2717.  
  2718.     '-------------------------------------------------------------------------
  2719.  
  2720.     Function setNIC()
  2721.  
  2722.         Err.Clear
  2723.  
  2724.         On Error resume next
  2725.  
  2726.         Dim objInstance                                
  2727.  
  2728.         Dim objService
  2729.  
  2730.         Dim objRegistry            'holds registry connection object
  2731.  
  2732.         Dim arrIPList
  2733.  
  2734.         Dim arrSubnetList        'holds subnet array list
  2735.  
  2736.         Dim arrGATEWAYList()    'holds gateway array list    
  2737.  
  2738.         Dim arrTemp
  2739.  
  2740.         Dim arrMetricList
  2741.  
  2742.         Dim strSettingID        'holds setting ID    
  2743.  
  2744.         Dim StrIP
  2745.  
  2746.         Dim strSubnet
  2747.  
  2748.         Dim strGATEWAY
  2749.  
  2750.         Dim strMetric
  2751.  
  2752.         Dim strTmpIP
  2753.  
  2754.         Dim strTmpGATEWAY
  2755.  
  2756.         Dim i
  2757.  
  2758.         Dim intReturnValue 
  2759.  
  2760.         Dim arrGATEWAY
  2761.         
  2762.         Dim strRetURL
  2763.         
  2764.         Dim retVal        
  2765.  
  2766.         Redim arrIPList(0)
  2767.  
  2768.         Redim arrGATEWAYList(0)
  2769.  
  2770.         Redim arrSubnetList(0)
  2771.     
  2772.  
  2773.         'Initializing to FALSE
  2774.  
  2775.         setNIC = FALSE
  2776.  
  2777.         
  2778.  
  2779.         Call SA_TraceOut(SOURCE_FILE, "setNIC")
  2780.  
  2781.         
  2782.  
  2783.         'Connecting to the server
  2784.  
  2785.         Set objService=GetWMIConnection(CONST_WMI_WIN32_NAMESPACE)
  2786.         
  2787.         if Err.number <> 0 then
  2788.  
  2789.             SA_ServeFailurePage L_WMI_CONNECTIONFAIL_ERRORMESSAGE
  2790.  
  2791.             Exit Function
  2792.  
  2793.         end if
  2794.  
  2795.         'Checks whether ServerAppliance IP Address is equal to IPAddress entered
  2796.          'Added check to only validate IP when we are specifying it (Static IP)
  2797.         if (NOT(F_strRadIP = 0)) AND (trim(g_initialIPAddress) <> trim(F_strIPAddress)) then
  2798.  
  2799.             '
  2800.             ' Check to see if address is in-use
  2801.             if ( TRUE = Ping(F_strIPAddress) ) then
  2802.                 
  2803.                 call SA_SetActiveTabPage(page,g_iTabGeneral)
  2804.                 
  2805.                 SA_SetErrMsg L_IP_INUSE_ERRORMESSAGE                            
  2806.                 exit function
  2807.             
  2808.             end if
  2809.             
  2810.         end if
  2811.                 
  2812.         'Getting the instance of the particulat NIC card 
  2813.  
  2814.         Set objInstance = getNetworkAdapterObject(objService,g_strDeviceID)
  2815.         
  2816.             
  2817.         If ( F_strRadIP = 0 ) Then
  2818.                     
  2819.                     
  2820.             Call SA_TraceOut(SOURCE_FILE, "Enabled DHCP")
  2821.             
  2822.                         
  2823.             if ( Not objInstance.DHCPEnabled ) then
  2824.  
  2825.                 intReturnValue =  enableDHCP(objInstance)
  2826.  
  2827.             end if
  2828.  
  2829.  
  2830.             'Connecting to default namespace to carry registry operations
  2831.             Set objRegistry=regConnection()
  2832.             
  2833.             If (objRegistry is Nothing) Then
  2834.  
  2835.                 SA_ServeFailurePage L_SERVERCONNECTIONFAIL_ERRORMESSAGE
  2836.  
  2837.                 Exit Function
  2838.  
  2839.             End If
  2840.         
  2841.             'Getting the SettingID
  2842.  
  2843.             strSettingID=objInstance.SettingID
  2844.             
  2845.             'Set Interface metric 
  2846.  
  2847.             intReturnValue=updateRegkeyvalue(objRegistry,G_CONST_REGISTRY_PATH & "\" & strSettingID ,"InterfaceMetric",F_nConnectionMetric,CONST_DWORD) 
  2848.  
  2849.             If intReturnValue = FALSE Then 
  2850.  
  2851.                 SA_SetErrMsg  L_NIC_IP_ERR_COULDNOTSETIPCONNECTIONMETRIC & "(" & Hex(Err.Number)  & ")"
  2852.  
  2853.                 Exit Function
  2854.  
  2855.             End If
  2856.  
  2857.             setNIC = TRUE
  2858.             
  2859.             'Release the objects
  2860.             Set objInstance = Nothing
  2861.             
  2862.             Set objRegistry=Nothing
  2863.             
  2864.             Exit Function
  2865.  
  2866.         End If
  2867.  
  2868.  
  2869.         
  2870.         'Connecting to default namespace to carry registry operations
  2871.         Set objRegistry=regConnection()
  2872.         
  2873.         if F_strListIP = "" then
  2874.  
  2875.             F_strListIP = F_strIPAddress & ":" & F_strSubnetMask
  2876.  
  2877.         end if     
  2878.  
  2879.  
  2880.         if F_strListGateway = "" then
  2881.  
  2882.             F_strListGateway = F_strGatewayAddress  & " "+L_METRIC_TEXT+" 1;"
  2883.  
  2884.         end if
  2885.  
  2886.     
  2887.  
  2888.         If (objRegistry is Nothing) Then
  2889.  
  2890.             SA_ServeFailurePage L_SERVERCONNECTIONFAIL_ERRORMESSAGE
  2891.  
  2892.             Exit Function
  2893.  
  2894.         End If
  2895.  
  2896.         
  2897.         'Getting the SettingID
  2898.  
  2899.         strSettingID=objInstance.SettingID
  2900.         
  2901.  
  2902.         Dim arrNewIp
  2903.  
  2904.         Dim arrNewSubnet
  2905.  
  2906.         Dim nPos
  2907.  
  2908.         
  2909.  
  2910.  
  2911.  
  2912.         'Split Ip List into arrays of Ip and Subnet mask
  2913.  
  2914.         nPos = InStr(F_strListIP, ";")
  2915.  
  2916.         
  2917.  
  2918.         if( Cint(nPos) = 0 ) then
  2919.  
  2920.             ReDim strTmpIP(0)
  2921.  
  2922.             strTmpIP(0) = F_strListIP
  2923.  
  2924.  
  2925.         else
  2926.  
  2927.             strTmpIP = Split(F_strListIP, ";",-1,1)
  2928.  
  2929.         end if
  2930.  
  2931.  
  2932.  
  2933.         ReDim arrNewIp(UBound(strTmpIp))
  2934.  
  2935.         ReDim arrNewSubnet(UBound(strTmpIp))
  2936.  
  2937.  
  2938.  
  2939.         'Loop to pack Ip's and subnetmasks in different variables
  2940.  
  2941.         For i= 0 To UBound(strTmpIp)
  2942.  
  2943.             arrTemp = Split(strTmpIP(i),":",-1,1)
  2944.  
  2945.             arrNewIp(i) = arrTemp(0)
  2946.  
  2947.             arrNewSubnet(i) = arrTemp(1)
  2948.  
  2949.         Next
  2950.  
  2951.                                         
  2952.  
  2953.         'Split Gateway List into arrays of gateway and metric
  2954.  
  2955.         strTmpGATEWAY = Split(F_strListGateway, ";", -1, 1)
  2956.     
  2957.         
  2958.         redim arrGATEWAY(UBound(strTmpGATEWAY))
  2959.  
  2960.         'Loop to pack Gateways's and Metrics in different variables
  2961.  
  2962.         For i= 0 to Ubound(strTmpGATEWAY)
  2963.  
  2964.             if strTmpGATEWAY(i) = "" then
  2965.                 exit for
  2966.             end if
  2967.  
  2968.             arrTemp = Split(strTmpGATEWAY(i)," "+L_METRIC_TEXT+" ",-1,1)
  2969.  
  2970.             
  2971.             If (isnull (strGATEWAY)) Then
  2972.  
  2973.                strGATEWAY = arrTemp(0)  & ";"
  2974.  
  2975.             Else
  2976.  
  2977.                strGATEWAY = strGATEWAY & arrTemp(0)  & ";" 
  2978.  
  2979.             End If
  2980.         
  2981.  
  2982.             If (isnull (strMetric)) Then
  2983.  
  2984.                strMetric = arrTemp(1)  & ";"
  2985.  
  2986.             Else
  2987.  
  2988.                strMetric = strMetric & arrTemp(1)  & ";" 
  2989.  
  2990.             End If
  2991.  
  2992.         Next
  2993.  
  2994.         'call wmi method EnableStatic in win32_networkadapterconfiguration to set the static ip
  2995.  
  2996.         'sets the ip and subnet
  2997.  
  2998.         Call objInstance.EnableStatic(arrNewIp, arrNewSubnet)
  2999.  
  3000.  
  3001.         If Err.Number <> 0 Then
  3002.  
  3003.             SA_SetErrMsg L_NIC_IP_ERR_COULDNOTSETIP & objInstance.Description & "(" & Hex(Err.Number) & ")"
  3004.  
  3005.             Exit Function
  3006.  
  3007.         end if
  3008.  
  3009.  
  3010.  
  3011.         if strGATEWAY <> "" then
  3012.  
  3013.             strGATEWAY=Mid(strGATEWAY,1,(Len(strGATEWAY)-1))
  3014.  
  3015.         end if
  3016.  
  3017.         
  3018.  
  3019.         'Splitting the string into array of GATEWAYS
  3020.  
  3021.         redim arrGATEWAY(UBound(strTmpGATEWAY))
  3022.  
  3023.         
  3024.  
  3025.         arrGATEWAY = split(strGATEWAY, ";", -1 ,1)
  3026.  
  3027.                                 
  3028.  
  3029.         if strMetric <> "" then
  3030.  
  3031.             strMetric=Mid(strMetric,1,(Len(strMetric)-1))
  3032.  
  3033.         end if        
  3034.  
  3035.         
  3036.  
  3037.         'Splitting the string into array of GATEWAYMetrics
  3038.  
  3039.         arrMetricList= split(strMetric, ";", -1 ,1) 
  3040.         
  3041.         
  3042.         'Sets gateway and connection metric            
  3043.         intReturnValue=objInstance.SetGateways(arrGATEWAY,arrMetricList)
  3044.  
  3045.         If intReturnValue <> 0 Then 
  3046.             SA_SetErrMsg L_NIC_IP_ERR_COULDNOTSETGATEWAY & objInstance.Description & "(" & Hex(Err.Number) & ")"
  3047.  
  3048.             Exit Function
  3049.  
  3050.         end if
  3051.  
  3052.         'Sets Interface metric 
  3053.  
  3054.         intReturnValue=updateRegkeyvalue(objRegistry,G_CONST_REGISTRY_PATH & "\" & strSettingID ,"InterfaceMetric",F_nConnectionMetric,CONST_DWORD) 
  3055.  
  3056.         If intReturnValue = FALSE Then 
  3057.  
  3058.             SA_SetErrMsg  L_NIC_IP_ERR_COULDNOTSETIPCONNECTIONMETRIC & "(" & Hex(Err.Number)  & ")"
  3059.  
  3060.             Exit Function
  3061.  
  3062.         End If
  3063.  
  3064.  
  3065.         
  3066.         'Set to Nothing
  3067.  
  3068.         Set objService=Nothing
  3069.  
  3070.         Set objRegistry=Nothing
  3071.  
  3072.         Set objInstance=Nothing
  3073.  
  3074.         setNIC = TRUE
  3075.  
  3076.         
  3077.     End Function
  3078.     
  3079.     
  3080.     '-------------------------------------------------------------------------
  3081.  
  3082.     'Function:                GetReturnURL
  3083.  
  3084.     'Description:            Forms new URL for changed IP
  3085.  
  3086.  
  3087.     'Input Variables:        strNewIP
  3088.  
  3089.     'Output Variables:        strRetURL        'returns newly formed URL
  3090.  
  3091.     'Returns:                string
  3092.  
  3093.     'Global Variables:        None
  3094.  
  3095.     '-------------------------------------------------------------------------
  3096.  
  3097.     Function GetReturnURL(strNewIp)
  3098.         Err.Clear
  3099.         On Error Resume Next
  3100.         
  3101.  
  3102.         GetReturnURL = ""
  3103.  
  3104.         Dim strRetURL
  3105.         Dim strBase
  3106.         Dim strTab
  3107.  
  3108.         strBase = SA_GetNewHostURLBase(strNewIp, SA_DEFAULT, FALSE, SA_DEFAULT)
  3109.  
  3110.         
  3111.         strRetURL = strBase & "network/nicinterface_prop.asp"
  3112.  
  3113.         strTab = GetTab1()
  3114.         
  3115.         If ( Len(strTab) > 0 ) Then
  3116.             Call SA_MungeURL(strRetURL, "Tab1", strTab)
  3117.         End If
  3118.             
  3119.         strTab = GetTab2()
  3120.         If ( Len(strTab) > 0 ) Then
  3121.             Call SA_MungeURL(strRetURL, "Tab2", strTab)
  3122.         End If
  3123.  
  3124.         Call SA_TraceOut(SOURCE_FILE, strRetURL)
  3125.         
  3126.         GetReturnURL = strRetURL
  3127.             
  3128.         
  3129.     End Function
  3130.  
  3131. Function Ping(ByVal sIP)
  3132.     on error resume next
  3133.     err.Clear()
  3134.  
  3135.     Dim oHelper
  3136.     Ping = FALSE
  3137.  
  3138.     Set oHelper = CreateObject("ComHelper.NetworkTools")
  3139.     if ( Err.Number <> 0 ) Then
  3140.         Call SA_TraceOut("INC_GLOBAL", "Error creating ComHelper.NetworkTools object, error: " + CStr(Hex(Err.Number)))
  3141.         Exit Function
  3142.     End If
  3143.  
  3144.     Ping = oHelper.Ping(sIP)
  3145.     if ( Err.Number <> 0 ) Then
  3146.         Ping = FALSE
  3147.         Call SA_TraceOut("INC_GLOBAL", "oHelper.Ping(), error: " + CStr(Hex(Err.Number)) + " " + Err.Description)
  3148.         Exit Function
  3149.     End If
  3150.  
  3151.     if ( Ping > 0 ) Then
  3152.         Ping = TRUE
  3153.     End If
  3154.     
  3155.     Set oHelper = Nothing
  3156.  
  3157. End Function
  3158.  
  3159.  
  3160. %>
  3161.